package org.come.Frame;

import java.awt.BorderLayout;
import java.awt.Image;
import java.awt.Point;
import java.awt.Toolkit;
import java.awt.image.MemoryImageSource;

import javax.swing.BorderFactory;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;
import javax.swing.plaf.basic.BasicInternalFrameUI;

import org.come.Jpanel.FrameMessageChangeJpanel;
import org.come.Jpanel.TestpackJapnel;
import org.come.Jpanel.XYJpanel;
import org.come.Jpanel.ZhuJpanel;
import org.come.mouslisten.Mouselistener;
import org.come.until.Music;

import com.tool.tcpimg.UIUtils;

public class ZhuFrame extends JInternalFrame {
	private static ZhuJpanel zhuJpanel;
	private Mouselistener mouselistener;
	private FrameMessageChangeJpanel changeJpanel;//消息面板s

	private static ZhuFrame zhuFrame;
	public static ZhuFrame getzhuframe(){
		if (zhuFrame==null) {
			try {
				zhuFrame=new ZhuFrame();
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
		return zhuFrame;
	}

	public ZhuFrame() throws Exception {
		//设置鼠标样式
//		Music.beijing(false);
		this.setBackground(UIUtils.Color_BACK);
		Image image = Toolkit.getDefaultToolkit().createImage(new MemoryImageSource(0, 0, new int[0], 0, 0));
		setCursor(Toolkit.getDefaultToolkit().createCustomCursor(image,new Point(0, 0), null));
		this.setBorder(BorderFactory.createEmptyBorder());//去除内部窗体的边框
		((BasicInternalFrameUI)this.getUI()).setNorthPane(null);//去除顶部的边框
		mouselistener=new Mouselistener();
		this.addMouseListener(mouselistener);
		this.addMouseMotionListener(mouselistener);
		changeJpanel=new FrameMessageChangeJpanel();//实例化消息面板
		zhuJpanel=new ZhuJpanel();
		this.add(zhuJpanel,BorderLayout.WEST);
		this.add(changeJpanel,BorderLayout.EAST);
		this.pack();
		this.setBounds(0, 0, this.getWidth(), this.getHeight());//设置窗口出现的位置
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		this.setVisible(true);
		//设置不可以缩放
		this.setResizable(false);
	}
	public static ZhuJpanel getZhuJpanel() {
		return zhuJpanel;
	}
	public static void setZhuJpanel(ZhuJpanel zhuJpanel) {
		ZhuFrame.zhuJpanel = zhuJpanel;
	}
	public Mouselistener getMouselistener() {
		return mouselistener;
	}
	public void setMouselistener(Mouselistener mouselistener) {
		this.mouselistener = mouselistener;
	}
	public FrameMessageChangeJpanel getChangeJpanel() {
		return changeJpanel;
	}
}
